package de.hhkk.view;

import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.jface.databinding.viewers.ViewersObservables;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Tree;

public class UINavigation extends Composite implements ObservableMainView
{

    private TreeViewer             trtNavigation;

    final private IObservableValue modeSelectionObservable;

    /**
     * Create the composite.
     * @param parent
     * @param style
     */
    public UINavigation(Composite parent, int style, String title)
    {
        super(parent, style);
        setLayout(new GridLayout(1, false));

        trtNavigation = new TreeViewer(this, SWT.BORDER);
        Tree tree = trtNavigation.getTree();
        GridData gd_tree = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
        gd_tree.widthHint = 191;
        gd_tree.heightHint = 271;
        tree.setLayoutData(gd_tree);

        modeSelectionObservable = ViewersObservables.observeSingleSelection(trtNavigation);
    }

    @Override
    protected void checkSubclass()
    {
        // Disable the check that prevents subclassing of SWT components
    }

    public TreeViewer getTreeViwer()
    {
        return trtNavigation;
    }

    @Override
    public IObservableValue getModeSelection()
    {
        // TODO Auto-generated method stub
        return modeSelectionObservable;
    }

}
